package com.w2cx.selenium.operate;

import com.w2cx.selenium.base.DriverBase;
import com.w2cx.selenium.page.TalentAuthManagePage;
import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS;

import java.io.IOException;

public class TalentAuthManageOpreate {

    DriverBase driver;
    TalentAuthManagePage tamp;
    public TalentAuthManageOpreate(DriverBase driver){
        this.driver = driver;
        tamp = new TalentAuthManagePage(driver);
    }

    //点击运营管理菜单
    public void clickOperateManageMenu(){
        tamp.click(tamp.getOperateManageMenu());
    }

    //点击“达人认证管理”菜单
    public void clickColdBootManageMenu(){
        tamp.click(tamp.getTalentAuthManageMenu());
    }

    //点击“添加达人”按钮
    public void clickAddTalentBtn(){
        tamp.click(tamp.getAddTalentBtn());
    }



    //点击“认证类型”下拉框
    public void clickAuthCategoryDownlist(){
        tamp.click(tamp.getAuthCategoryDownList());
    }



    //选择“认证类型”
    public void selectAuthCategoryOption(){
       tamp.click(tamp.getAuthCategoryOption());
    }


    //点击选择按钮
    public void clickSelectBtn(){
        tamp.click(tamp.getSelectBtn());
    }


    //获取选择的用户id
    public String getSelectedUserID(){
        return  tamp.getSelectedUserID().getText();
    }


    //选择一个用户
    public void clickFirstRadio(){
        tamp.click(tamp.getFirstUserRadio());
    }


    //完成按钮
    public void clickOverBtn(){
        tamp.click(tamp.getOverBtn());
    }


    //输入认证称号
    public void inputAuthName(String name){
        tamp.sendKeys(tamp.getAuthNameInput(),name);
    }


    public void clickMasterDestinationInput(){
        tamp.click(tamp.getMasterDestinationInput());
    }

    //输入精通目的地
    public void inputMasterDestinationName(String destinationName){
        tamp.sendKeys(tamp.getMasterDestinationInput(),destinationName);
    }


    //选择一个目的地选项
    public void selectDestinationOption(){
        tamp.click(tamp.getDestinationOption());
    }


    //选择擅长领域
    public void selectFiledCheckBox(){
        tamp.click(tamp.getFieldCheckBoxOption());
    }


    //点击上传身份证按钮
    public void clickUpIDCardImgBtn(){
        tamp.click(tamp.getUpIDCardAuthImgBtn());
    }

    //执行上传身份证脚本
    public void exeUpIDCardImgFrontScript(){
        //调用exe程序
        Runtime exe = Runtime.getRuntime();
        String path = System.getProperty("user.dir");
        System.out.println("当前工程路径为："+path);
        String exeScript = path+"\\"+"exe"+"\\"+"upIDCardImgFront.exe";
        try {
            exe.exec(exeScript);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    //点击上传身份证按钮
    //public void clickUpIDCardImgBtnAgain(){
     /*   tamp.click(tamp.getUpIDCardAuthImgBtn());
    }
*/
    //执行上传身份证脚本
    public void exeUpIDCardImgBehindScript(){
        //调用exe程序
        Runtime exe = Runtime.getRuntime();
        String path = System.getProperty("user.dir");
        System.out.println("当前工程路径为："+path);
        String exeScript = path+"\\"+"exe"+"\\"+"upIDCardImgFront.exe";
        try {
            exe.exec(exeScript);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    //点击上传封面图按钮
    public void clickUpCoverImgBtn(){
        tamp.click(tamp.getUpCoverImgBtn());
    }


    //执行上传封面图脚本
    public void exeUpCoverImgScript(){
        //调用exe程序
        Runtime exe = Runtime.getRuntime();
        String path = System.getProperty("user.dir");
        System.out.println("当前工程路径为："+path);
        String exeScript = path+"\\"+"exe"+"\\"+"upCover.exe";
        try {
            exe.exec(exeScript);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    //点击确认按钮
    public void clickConfirmBtn(){
        tamp.click(tamp.getConfirmBtn());
    }

    //获得第一个用户id
    public String getFirstUserID(){
       return tamp.getFirstUserID().getText();
    }

    //点击去审核
    public void clickToReviewBtn(){
        tamp.click(tamp.getToReviewBtn());
    }

    //点击认证等级
    public void clickAuthLevelRadio(){
        tamp.click(tamp.getAuthLevelRadio());
    }


    //点击确认按钮
    public void clickAuthConfirmBtn(){
        tamp.click(tamp.getAuthConfirmBtn());
    }


    //获取认证状态
    public String getAuthStatus(){
        return tamp.getAuthStatus().getText();
    }



}
